package com.snk.back.controller;


import com.snk.back.service.SysReasonService;
import com.snk.common.pojo.JsonResult;
import com.snk.pojo.SysReason;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/reason/")
public class SysReasonController {
	@Autowired
	private SysReasonService sysReasonService;
	@RequestMapping("doFindObjects")
	public JsonResult doFindObjects() {
		return new JsonResult(sysReasonService.findObjects());
	}
	@RequestMapping("doFindZTreeNodes")
	public JsonResult doFindZTreeNodes() {
		return new JsonResult(sysReasonService.findZTreeNodes());
	}
	
	@RequestMapping("doUpdateObject")
	public JsonResult doUpdateObject(SysReason sysReason){
		sysReasonService.updateObject(sysReason);
	    return new JsonResult("update ok");
	}
	
	@RequestMapping("doSaveObject")
	public JsonResult doSaveObject(SysReason sysReason){
		sysReasonService.saveObject(sysReason);
		return new JsonResult("save ok");
	}
	@RequestMapping("doDeleteObject")
	@ResponseBody
	public JsonResult doDeleteObject(Integer id){
		sysReasonService.deleteObject(id);
		return new JsonResult("delete ok");
	}
}
